Skip to content

feat: move custom errors from libraries to interfaces for external accessibility (#57)#84

Merged
mudgen merged 2 commits into
Perfect-Abstractions:mainfrom
ogazboiz:feat/move-errors-to-interfaces
Oct 22, 2025
Merged

feat: move custom errors from libraries to interfaces for external accessibility (#57)#84
mudgen merged 2 commits into
Perfect-Abstractions:mainfrom
ogazboiz:feat/move-errors-to-interfaces

Conversation

@ogazboiz

Copy link
Copy Markdown
Contributor

This PR moves custom errors from internal libraries to public interfaces. External users can now access these errors directly.

Fixes #57

Problem:
Custom errors were buried in libraries. UI developers had no canonical access to these errors. They had to reimplement errors elsewhere, introducing inconsistencies and making Compose adoption difficult.

Solution:
Created interface files with all custom errors. Updated libraries and facets to import errors from interfaces instead of defining them locally.

Changes:
• Created IERC20.sol with all ERC20 custom errors
• Created IERC721.sol with all ERC721 custom errors
• Created IERC721Enumerable.sol with all ERC721Enumerable custom errors
• Created IERC173.sol with all ERC173 custom errors
• Updated all libraries to import interface errors
• Updated all facets to import interface errors
• Fixed import paths for proper compilation

Benefits:
• External users get direct access to custom errors
• UI developers have canonical error definitions
• Follows industry standard of declaring errors in interfaces
• Maintains full backward compatibility
• All tests pass

Technical Details:
Error references now use format IERC20.ERC20InsufficientBalance(...) instead of ERC20InsufficientBalance(...). All files compile successfully with no breaking changes.

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@ogazboiz Thanks for doing this work. I do appreciate it.

Look at this comment: #57 (comment)

It says this:

At this point interfaces may be made and put in an interfaces directory, so they can be accessed by users in the future. Only standard interfaces such as ERC20, ERC721 etc. should be made. Interfaces may not be imported or used by contracts or libraries within Compose. That may change in the future.

Please remove any use of interfaces and put all the interfaces into the directory here: src/interfaces.

@mudgen mudgen self-assigned this Oct 22, 2025
@ogazboiz

Copy link
Copy Markdown
Contributor Author

@ogazboiz Thanks for doing this work. I do appreciate it.

Look at this comment: #57 (comment)

It says this:

At this point interfaces may be made and put in an interfaces directory, so they can be accessed by users in the future. Only standard interfaces such as ERC20, ERC721 etc. should be made. Interfaces may not be imported or used by contracts or libraries within Compose. That may change in the future.

Please remove any use of interfaces and put all the interfaces into the directory here: src/interfaces.

alright i am doing that

@ogazboiz

Copy link
Copy Markdown
Contributor Author

I've implemented your feedback. All interface files are now in src/interfaces/ directory and I've removed all interface imports and usage from contracts and libraries. The interfaces are now standalone files for external users only, while all internal code uses local error definitions. @mudgen

@mudgen mudgen merged commit 2f5dbbd into Perfect-Abstractions:main Oct 22, 2025
1 check passed
@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@ogazboiz Good job. Merged.

@ogazboiz

ogazboiz commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

i am really happy to contrbute

Hi, I see the contributor shows as "ogazboizz" but that should be "ogazboiz" (my personal account that pushed the code). Could you correct the contributor attribution? The code was developed and pushed from my personal GitHub account. @mudgen

can you help me with that?

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

Yes, sorry about that. Do you mean in the comment I left? Or somewhere else?

@ogazboiz

Copy link
Copy Markdown
Contributor Author

Yes, sorry about that. Do you mean in the comment I left? Or somewhere else?

Hi @mudgen!

I'm looking at the contributor section and it shows "ogazboizz" as the contributor, but that's not my account. It should show "ogazboiz" (my personal GitHub account that I used to develop and push the code).

Could you update the contributor attribution? Thanks for letting me contribute to this awesome project!

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@ogazboiz Yes, I see. This is a weird thing that Github used the wrong username. Right now I don't see how to change this. Do you know how to change this?

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@ogazboiz To fix this I think you will need to make your email address associated with your @ogazboiz account rather than your @ogazboizz account, or give me another email address that I can change the commits to use which is associated with your @ogazboiz account.

@ogazboiz

Copy link
Copy Markdown
Contributor Author

Hi @mudgen!

Thanks for offering to help fix this! My personal email associated with my @ogazboiz account is: ogazboizakpolo@gmail.com

I've also created a follow-up PR #86 that addresses the attribution issue. The new PR adds author attribution to all interface files and will show the correct @ogazboiz account since I've fixed my Git configuration.

You can either use the email to update the existing commits, or check out PR #86 for the proper attribution going forward.

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@ogazboiz
Okay, now that you have fixed your git configuration, I think the safe thing to do is this:

  1. I can remove your changes from the repository.
  2. You submit a new pull request with the same changes.
  3. I merge those changes.

This way your correct account should show up in the contributors section and show what you have done.
Should we proceed with this plan?

@ogazboiz

ogazboiz commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

alright @mudgen or you can just merge my follow up pr

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

alright @mudgen or you can just merge my follow up pr

No, I won't do that. We are not currently attributing authors like that, and I want the code to remain consistent. If contributors want better attribution or credit then we will figure out a consistent way to do that.

@ogazboiz

Copy link
Copy Markdown
Contributor Author

alright @mudgen or you can just merge my follow up pr

No, I won't do that. We are not currently attributing authors like that, and I want the code to remain consistent. If contributors want better attribution or credit then we will figure out a consistent way to do that.

no problem sir.
just let me know when you remove the changes so i can just create pr again

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

It is done. Ready for your new PR.

@ogazboiz

Copy link
Copy Markdown
Contributor Author

It is done. Ready for your new PR.

i have created a pr #89

JackieXu pushed a commit to JackieXu/Compose that referenced this pull request Nov 6, 2025
…rors-to-interfaces

feat: move custom errors from libraries to interfaces for external accessibility (Perfect-Abstractions#57)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal - Move ERC20 and other errors to interfaces

3 participants